package cn.wit.summit.chwan.widgets;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.bigkoo.convenientbanner.holder.Holder;
import com.facebook.drawee.view.SimpleDraweeView;

import cn.wit.summit.chwan.R;
import cn.wit.summit.chwan.models.dto.JumpBaseBean;
import cn.wit.summit.chwan.utils.IntentUtil;

/**
 * Created by Alan on 2018/9/21.
 */

public class NetworkImageHolderView extends Holder<JumpBaseBean> {
    private SimpleDraweeView gameLibTopIv;
    private View rootview;
    private Activity activity;

    public NetworkImageHolderView(View itemView, Activity activity) {
        super(itemView);
        this.activity = activity;
    }

//    public NetworkImageHolderView(Activity activity) {
//        this.activity = activity;
//        rootview = ((LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.item_banner_view, null);
//        super(rootview);
//    }

//    @Override
//    public View createView(Context context) {
//        rootview = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.item_banner_view, null);
//        gameLibTopIv = rootview.findViewById(R.id.gameLibTopIv);
//        return rootview;
//    }
//
//    @Override
//    public void UpdateUI(Context context, int position, final JumpBaseBean data) {
//        gameLibTopIv.setImageURI(data.getJump_cover_big_pic());
//        gameLibTopIv.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                IntentUtil.getInstance().intentTo(activity, data);
//            }
//        });
//    }

    @Override
    protected void initView(View itemView) {
        gameLibTopIv = itemView.findViewById(R.id.gameLibTopIv);
    }

    @Override
    public void updateUI(final JumpBaseBean data) {
        gameLibTopIv.setImageURI(data.getJump_cover_big_pic());
        gameLibTopIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                IntentUtil.getInstance().intentTo(activity, data);
            }
        });
    }
}
